/// @tags: NetworkFlow MinCost
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#define rint register int

using std::cin;
using std::cout;

namespace BlueQuantum {

constexpr int maxn = 5e3 + 3, maxm = 5e4 + 3, INF = 0x3f3f3f3f;

int ecnt = 1;
int heads[maxn], cur[maxn];

struct Edge {
  int v, nxt, w, f;
} e[maxm * 2];

inline void add(int u, int v, int w, int f) {
  e[++ecnt].v = v, e[ecnt].nxt = heads[u], heads[u] = ecnt, e[ecnt].w = w, e[ecnt].f = f;
  e[++ecnt].v = u, e[ecnt].nxt = heads[v], heads[v] = ecnt, e[ecnt].w = -w, e[ecnt].f = 0;
}

int dis[maxn], vis[maxn];

inline bool bfs(int s, int t) {
  std::queue<int> q;
  memset(dis, INF, sizeof(dis));
  memset(vis, 0, sizeof(vis));
  memcpy(cur, heads, sizeof(cur));
  q.push(s);
  dis[s] = 0;
  vis[s] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    vis[u] = false;
    for (int i = heads[u]; i; i = e[i].nxt) {
      int v = e[i].v;
      if (dis[v] > dis[u] + e[i].w && e[i].f) {
        dis[v] = dis[u] + e[i].w;
        if (vis[v] == false) {
          q.push(v);
          vis[v] = true;
        }
      }
    }
  }
  return dis[t] != INF;
}

int dinic(int u, int t, int flow, int &cost) {
  if (u == t) return flow;
  int rest = flow;
  vis[u] = true;
  for (int &i = cur[u]; i; i = e[i].nxt) {
    int v = e[i].v;
    if (dis[v] == dis[u] + e[i].w && e[i].f && vis[v] == false) {
      int k = dinic(v, t, std::min(rest, e[i].f), cost);
      cost += k * e[i].w;
      e[i].f -= k;
      e[i ^ 1].f += k;
      rest -= k;
      if (rest == 0) break;
    }
  }
  vis[u] = false;
  return flow - rest;
}

inline int main() {
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  for (int i = 1; i <= m; ++i) {
    int u, v, w, f;
    cin >> u >> v >> f >> w;
    add(u, v, w, f);
  }
  int flow = 0, cost = 0;
  while (bfs(s, t)) {
    flow += dinic(s, t, INF, cost);
  }
  cout << flow << ' ' << cost;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("mcmf_dinic.in", "r", stdin);
  freopen("mcmf_dinic.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
